Skip to content

chore: add e2e tests for custom linting rules#9989

Open
Ali-Sab wants to merge 1 commit into
developfrom
chore/custom-lint-rules-e2e-tests-v2
Open

chore: add e2e tests for custom linting rules#9989
Ali-Sab wants to merge 1 commit into
developfrom
chore/custom-lint-rules-e2e-tests-v2

Conversation

@Ali-Sab
Copy link
Copy Markdown
Contributor

@Ali-Sab Ali-Sab commented May 29, 2026

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

✅ Circular References Report

Generated at: 2026-06-05T22:41:29.247Z
Status: ✅ NO CHANGE

Summary

Metric Base (develop) PR Change
Total Circular References 8 8 0 (0.00%)
Click to view all circular references in PR (8)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/insomnia.ts -> insomnia-scripting-environment/src/objects/interfaces.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx
Click to view all circular references in base branch (8)
insomnia-inso/src/db/models/types.ts -> insomnia-inso/src/db/types.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/collection.ts -> insomnia-scripting-environment/src/objects/response.ts
insomnia/src/network/network.ts -> insomnia-scripting-environment/src/objects/index.ts -> insomnia-scripting-environment/src/objects/insomnia.ts -> insomnia-scripting-environment/src/objects/interfaces.ts
insomnia/src/network/network.ts -> insomnia/src/common/render.ts
insomnia/src/ui/components/settings/import-export.tsx -> insomnia/src/ui/components/modals/export-requests-modal.tsx
insomnia/src/ui/components/tabs/tab-list.tsx -> insomnia/src/ui/components/tabs/tab.tsx
insomnia/src/ui/components/templating/tag-editor-arg-sub-form.tsx -> insomnia/src/ui/components/templating/external-vault/external-vault-form.tsx
insomnia/src/ui/components/viewers/response-viewer.tsx -> insomnia/src/ui/components/viewers/response-multipart-viewer.tsx

Analysis

No Change: This PR does not introduce or remove any circular references.


This report was generated automatically by comparing against the develop branch.

@Ali-Sab Ali-Sab force-pushed the chore/custom-lint-rules-e2e-tests-v2 branch 18 times, most recently from 399fcdb to 74d3d0a Compare June 2, 2026 17:40
@Ali-Sab Ali-Sab marked this pull request as ready for review June 2, 2026 17:54
Copilot AI review requested due to automatic review settings June 2, 2026 17:54
Comment thread packages/insomnia-smoke-test/server/cloud-sync-api.ts
Comment thread packages/insomnia-smoke-test/server/cloud-sync-api.ts
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new smoke test suite that exercises uploading/removing custom Spectral rulesets across persistence boundaries (app relaunch), cloud sync round-trips (including a 2-user scenario), and git-sync filesystem mirroring. To support this, the smoke-test mock APIs and Playwright harness gain a few capabilities (multi-user org data, decrypting pushed blobs, and a reusable relaunchable Electron launcher).

Changes:

  • Add a comprehensive smoke test suite for custom Spectral lint rules across local, cloud-sync, and git-sync scenarios.
  • Add a Playwright/Electron test hook for showOpenDialog, plus Playwright harness support for process-level relaunch and multi-app teardown.
  • Extend smoke-test mock servers to support a second “User B” identity and decrypt pushed cloud-sync blobs for round-trip validation.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/insomnia/src/main/ipc/electron.ts Adds a Playwright-only showOpenDialog hook to return queued dialog results instead of opening a native dialog.
packages/insomnia-smoke-test/tests/smoke/custom-lint-rules.test.ts New E2E suite covering upload/remove/persist + cloud sync + git-sync parity for custom Spectral rules.
packages/insomnia-smoke-test/server/insomnia-api.ts Adds mock org/project data for a second user used in multi-user cloud-sync tests.
packages/insomnia-smoke-test/server/cloud-sync-api.ts Replaces node-forge AES-GCM usage with Node crypto, adds design-project data, multi-user team member keys toggle, and decrypts pushed blobs.
packages/insomnia-smoke-test/playwright/test.ts Refactors Electron launch into a shared helper and ensures all launched Electron apps are closed during teardown (supports relaunch).
packages/insomnia-smoke-test/playwright/pages/insomnia-app.ts Enables InsomniaApp.relaunch() (process-level) and adds queueOpenDialogResponse() for the dialog hook.
packages/insomnia-smoke-test/playwright/launch.ts New shared Electron launcher + liveApps tracking for reliable teardown.
packages/insomnia-smoke-test/fixtures/files/custom.spectral.yaml Adds a Spectral ruleset fixture used by the new smoke tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/insomnia/src/main/ipc/electron.ts
Comment thread packages/insomnia-smoke-test/tests/smoke/custom-lint-rules.test.ts Outdated
@Ali-Sab Ali-Sab force-pushed the chore/custom-lint-rules-e2e-tests-v2 branch 5 times, most recently from 51157c0 to 2feb9da Compare June 4, 2026 15:59
@Ali-Sab Ali-Sab force-pushed the chore/custom-lint-rules-e2e-tests-v2 branch from 2feb9da to 49d6987 Compare June 4, 2026 17:48
Copy link
Copy Markdown
Contributor

@fiosman fiosman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this! Appreciate that you were trying to cover as much as possible. I left some comments that we should consider.

Also, we should consider whether we care about testing persistence on app reloads etc (e.g. relaunch function you added). Sometimes it's not worth it if it adds complexity/maintenance efforts to an already flaky/large e2e test suite. In my opinion, end to end tests are supposed to be limited to critical user paths (in this case; on a cloud sync project, one test that uploads a custom ruleset, spec is automatically linted, diff shows up in commit modal, and I am able to push the changes). Unit tests and/or component tests, which run much faster, can cover edge cases. Lmk your thoughts! Great work.

Comment on lines +1 to +10
extends: [spectral:oas]
rules:
require-x-smoke-test-marker:
description: info object must contain a custom x-smoke-test-marker field
message: "{{description}}"
severity: error
given: $.info
then:
field: x-smoke-test-marker
function: truthy
Copy link
Copy Markdown
Contributor

@fiosman fiosman Jun 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, should we also include a fixture with disallowed top level keys (e.g. custom functions). In the smoke test we can make assertion that an error pops up when linting the spec. We just need 1 test to check the modal pops up etc.

This is totally OK to leave out; technically it's an edge case that I think I am already covering in a unit test for a validation function I wrote.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid, I'll add it !

Comment on lines +244 to +246
await expect.soft(page.getByRole('button', { name: 'View selected ruleset content' })).toBeVisible({
timeout: 15_000,
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth opening up the modal and verifying the content matches what the ruleset content is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it might be, I'll add something in

// fresh machine, pulls the project, and verifies the ruleset survived the
// sync handoff.
// -------------------------------------------------------------------------
test.describe.serial('different users, same project', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be using serial? If I were to add a .only to any of the tests below they would fail because they rely on state from previous tests? We don't currently use this anywhere in our codebase.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, let me merge the serial pairs into a single test, it's only one scenario anyway. Actually, on also checking playwright's docs, serial is discouraged for use, so good call here!

Comment on lines +437 to +442
if (process.env.PLAYWRIGHT === 'true') {
const queue = globalThis.__PLAYWRIGHT_OPEN_DIALOG_QUEUE__;
if (queue && queue.length > 0) {
return queue.shift();
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we utilize existing mockOpenDialogForDirectory? It seems to mock behaviour for native file picker which I think is what you are trying to do this here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on the inconsistency. The reason I didn't reuse it is that mockOpenDialogForDirectory works by permanently replacing the ipcMain handler (removeHandler + handle), so after it fires the real dialog is gone for the rest of the process. The queue approach is just a list that gets shifted on each call and falls through to the real dialog when empty, which felt safer for tests that might open multiple dialogs. Happy to revisit if I'm mistaken or we just don't need the queue

@Ali-Sab Ali-Sab force-pushed the chore/custom-lint-rules-e2e-tests-v2 branch 6 times, most recently from 1ac1ad4 to 7c9346d Compare June 5, 2026 22:01
@Ali-Sab Ali-Sab force-pushed the chore/custom-lint-rules-e2e-tests-v2 branch from 7c9346d to fa3bdc6 Compare June 5, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants